//
//  MYGPatientAddTableViewCell.swift
//  MYDoctor
//
//  Created by 王振明 on 2024/4/18.
//

import UIKit

class MYGPatientAddTableViewCell: UITableViewCell {
    var modelDa:MYGPatientModel = MYGPatientModel(){
        didSet{
            headerImageBV.sd_setImage(with: URL(string: modelDa.avatar))
            nameLabel.text = modelDa.name
            contentLabel.text = modelDa.cityString
        }
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        initUI()
    }
    private func initUI(){
        contentView.addSubview(selectBtn)
        selectBtn.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(19)
            make.centerY.equalToSuperview()
            make.size.equalTo(CGSize(width: 15, height: 15))
        }
        contentView.addSubview(headerImageBV)
        headerImageBV.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(selectBtn.snp.right).offset(17)
            make.size.equalTo(CGSize(width: 50, height: 50))
        }
        contentView.addSubview(nameLabel)
        nameLabel.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(22)
            make.left.equalTo(headerImageBV.snp.right).offset(11)
            make.height.equalTo(22.5)
        }
        contentView.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { make in
            make.top.equalTo(nameLabel.snp.bottom).offset(5)
            make.left.equalTo(headerImageBV.snp.right).offset(11)
            make.height.equalTo(18.5)
        }
        contentView.addSubview(lineView)
        lineView.snp.makeConstraints { make in
            make.bottom.equalToSuperview()
            make.left.equalTo(contentLabel.snp.left)
            make.height.equalTo(0.5)
            make.right.equalToSuperview().offset(-30)
        }
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    lazy var headerImageBV: UIImageView = {
        let cont = UIImageView()
        cont.layer.cornerRadius = 25
        cont.layer.masksToBounds = true
        cont.contentMode = .scaleAspectFill
        return cont
    }()
    lazy var nameLabel: UILabel = {
        let cont = UILabel()
        cont.text = ""
        cont.font = .medium(16)
        cont.textColor = .rgba(44, 44, 44)
        return cont
    }()
    lazy var contentLabel: UILabel = {
        let cont = UILabel()
        cont.text = ""
        cont.font = .regular(13)
        cont.textColor = .rgba(126, 126, 126)
        return cont
    }()
    lazy var lineView: UIView = {
        let cont = UIView()
        cont.backgroundColor = .rgba(238, 238, 238, 1)
        return cont
    }()
    lazy var selectBtn:UIButton = {
        let cont = UIButton()
        cont.setImage(UIImage(named: "Chat/Menu/circle"), for: .normal)
        cont.setImage(UIImage(named: "Chat/Menu/circle_sel"), for: .selected)
        return cont
    }()
}
